///////////////////////////////////////////////////////////////////////////////
//	FILENAME:	PEN.m
//	SUMMARY:	Defines a protocol for the PEN agents for eText documents
//	PROTOCOLS:	<Agent>
//	INTERFACES:	PEN.nib
//	AUTHOR:		Rohit Khare
//	COPYRIGHT:	(c) 1993,4 California Institure of Technology, eText Project
///////////////////////////////////////////////////////////////////////////////
//	DESCRIPTION
//		This is a demo mockup of PEN.
///////////////////////////////////////////////////////////////////////////////
//	HISTORY
//	05/05/94:	Migrated to eText4
//	11/15/93:	Created. Derived from calls in the rest of the code
///////////////////////////////////////////////////////////////////////////////

#import "PEN.h"

@implementation PEN

+ toolAwake:theApp
{
	[theApp registerAgent:[PEN class] 
					 name:NXUniqueString("PEN")
				menuLabel:NXUniqueString("PEN Helper")
				  menuKey:0];
	return self;
}

- init
{
	char        buf[MAXPATHLEN];
	NXBundle   *bundle;
 
 	bundle = [NXBundle bundleForClass:[PEN class]];
	if ( [bundle getPath:buf forResource:"PEN" ofType:"nib"] ) {
		[NXApp loadNibFile:buf owner:self withNames:NO];
	} else {
		NXLogError("NIB not found: PEN");
	}
	return self;
}

- awakeFromNib
{
	theView = [thePanel contentView];
	return self;
}

- (const char*) name {return NXUniqueString("PEN");} 

- init:theNavinfo {[self init]; navinfo = theNavinfo; return self;}

//- free {[thePanel free]; return [super free];}
- controlView  {return theView;}

- getMinSize:(NXSize *) min
{	
	NXRect bounds;
	
	[theView getBounds:&bounds];
	min->width = bounds.size.width;
	min->height = 0.0; // 24.0;
	return self;
}

- getMaxSize:(NXSize *) max
{	
	NXRect bounds;

	[theView getBounds:&bounds];
	max->width = bounds.size.width;
	max->height = bounds.size.height;
	return self;
}

@end